import { defineStore } from 'pinia'

const appStoreCreater = defineStore({
  id: 'appState',
  state: () => ({
    isCollapse: false, // 侧边菜单栏是否是折叠状态 //true：折叠     false：展开
  }),
  actions: {
    // 是否需要收起侧边栏
    verdictLefMenuHide() {
      return document.body.clientWidth <= 1000 && !this.isCollapse
    },
    // 是否需要展开侧边栏
    verdictLefMenuShow() {
      return document.body.clientWidth > 1000 && this.isCollapse
    },
    toggleCollapse() {
      this.isCollapse = !this.isCollapse
    },
    changeCollapse(val) {
      this.isCollapse = val
    },
  },
})
export default appStoreCreater
